package cl.zeke.remoto.jms;

import cl.zeke.comun.dto.Persona;
import cl.zeke.remoto.negocio.services.ComunesService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 *
 * @author taller
 */

@Component
public class RemotoQueueHandler {
    
    private static Logger log = LoggerFactory.getLogger(RemotoQueueHandler.class);
    
    @Autowired
    private ComunesService comunesService;
    
    public void procesarQueue(Persona persona) {
        
        //obtiene el elemento de la cola
        comunesService.procesarPersona(persona);
        
        //simula un proceso pesado
        try {
            Thread.sleep(10000);
        }catch(Exception ex) {
            log.error("error", ex);
        }
        
    }
    
}
